import React,{Component} from "react";
import DemoC1 from "./Child";
class DemoP1 extends Component {
  state = {  
    price:1000
  }
  updatePrice = (price)=>{
    this.setState({
      price
    })
  }
  render() { 
    return (
    <div>
      <h3>7.2.子组件给父子组件传值</h3>
      <p>父组件</p>
      当前车的价格为:{this.state.price}
      <DemoC1 updatePrice={this.updatePrice} price={this.state.price}/>
    </div>
    );
  }
}
 
export default DemoP1;